package cn.le.aopAnnotationDataSource.jdbc;

/**
 * Created by admin on 2017/3/28.
 * 设置,获取数据源链接
 */
public class JdbcContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    public static void setJdbcType(String jdbcType)
    {
        contextHolder.set(jdbcType);
    }
    public static void setSlave()
    {
        setJdbcType("slave");
    }
    public static void setMaster()
    {
        setJdbcType("master");
    }
    public static String getJdbcType()
    {
        return contextHolder.get();
    }
    public static void clearJdbcType()
    {
        contextHolder.remove();
    }

}
